<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * observer for dom event.
 * @author yiminghe@gmail.com
 */
KISSY.add('event/dom/base/observer', function (S, Special, BaseEvent) {
<span id='KISSY-Event-DomEvent-Observer'>    /**
</span>     * observer for dom event
     * @class KISSY.Event.DomEvent.Observer
     * @extends KISSY.Event.Observer
     * @private
     */
    function DomEventObserver(cfg) {
        DomEventObserver.superclass.constructor.apply(this, arguments);
<span id='KISSY-Event-DomEvent-Observer-cfg-filter'>        /**
</span>         * filter selector string or function to find right element
         * @cfg {String} filter
         */
<span id='KISSY-Event-DomEvent-Observer-cfg-data'>        /**
</span>         * extra data as second parameter of listener
         * @cfg {*} data
         */
    }

    S.extend(DomEventObserver, BaseEvent.Observer, {
        keys: ['fn', 'filter', 'data', 'context', 'originalType', 'groups', 'last'],

        notifyInternal: function (event, ce) {
            var self = this,
                s, t, ret,
                type = event.type,
                originalType;

            if (originalType = self.originalType) {
                event.type = originalType;
            } else {
                originalType = type;
            }

            // context undefined 时不能写死在 listener 中，否则不能保证 clone 时的 this
            if ((s = Special[originalType]) &amp;&amp; s.handle) {
                t = s.handle(event, self, ce);
                // can handle
                if (t &amp;&amp; t.length &gt; 0) {
                    ret = t[0];
                }
            } else {
                ret = self.simpleNotify(event, ce);
            }

            if (ret === false) {
                event.halt();
            }

            // notify other mousemove listener
            event.type = type;

            return ret;
        }
    });

    return DomEventObserver;
}, {
    requires: ['./special', 'event/base']
});</pre>
</body>
</html>
